﻿using System;
using FinPlusComponents;

namespace FinPlusAnalytics
{
    public class FixedRateBond : FinPlusComponent
    {
        //construct
        public FixedRateBond(string marketName, string cacheName, string id, string bondName, string curveName, double nominal, DateTime settlementDate, double tradePrice)
        {
            Id = id;
            var market = Markets.Instance.GetMarket(marketName);
            var cache = Caches.Instance.GetCache(cacheName);
            var bond = market.GetBond(bondName);

		    var trade = new FixedRateBondTrade(bond, nominal/100, settlementDate, tradePrice);

            cache.Add(id, trade, curveName);
        }
    }
}
